//
//  XYNetwork.swift
//  XYNetwork
//
//  Created by lxy on 2021/1/29.
//

//url: https://my-json-server.typicode.com/ShadowTourist/test/db
import Foundation

public class XYNetwork {
    public static let share = XYNetwork()
    
    public func request(_ target: TargetType) -> Cancellable {
        return CancellableWrapper()
    }
}

public enum TestEnum {
    case test
}

extension TestEnum: TargetType {
    public var path: String { return "db" }
    public var method: XYMethod { return .get }
    public var baseURL: URL { return URL(string: "https://my-json-server.typicode.com/ShadowTourist/test")! }
}

class Session {
    init() {
        
    }
    
    func sessionDataTaskRequest(_ target: TargetType) {
        var request = URLRequest(url: target.baseURL)
        request.httpMethod = target.method.rawValue
        
        let session = URLSession.shared
        let task = session.dataTask(with: request) { (data, response, error) in
            
        }
        task.resume()
    }
}
